﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Win.Templates.ActionContainers;
using DevExpress.XtraEditors;

namespace AppSolution.Module
{

    public partial class UserControl1 : UserControl//, ICustomUI
    {
        //private INavUIDetailViewItem _model;
        //private NavUIDetailViewItem _item;
        private XafApplication helper;
        public UserControl1(XafApplication app)//INavUIDetailViewItem model, NavUIDetailViewItem item)
        {
            InitializeComponent();
            //  _model = model;
            //  _item = item;
            helper = app;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            //XafApplication
            //            _model.Application.Application
            // ButtonsContainer button = new ButtonsContainer();
            IObjectSpace objectSpace = helper.CreateObjectSpace();
            ShowViewParameters svp = new ShowViewParameters();
            svp.CreatedView = helper.CreateListView(objectSpace, typeof(TestObjectSpace), true);
            svp.TargetWindow = TargetWindow.Current;
            svp.Context = TemplateContext.View;
            svp.CreateAllControllers = true;
            ShowViewSource svs = new ShowViewSource(helper.MainWindow, null);
            helper.ShowViewStrategy.ShowView(svp, svs);

        }
    }
}
